package com.tree.threadpool.service.impl;

import com.tree.threadpool.service.AsyncService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * @ClassName AsyncServiceImpl
 * @Description: TODO
 * @Author: myl
 * @Create_time:2021/5/6 10:12
 */
@Service
@Slf4j
public class AsyncServiceImpl implements AsyncService {


    @Override
    @Async("asyncServiceExecutor")
    public void executeAsync() {
        log.info("start executeAsync");

        for (int i = 0; i < 10; i++) {

            System.out.println(Thread.currentThread().getName()+"---"+i);

        }


        log.info("end executeAsync");
    }

}
